
//
//  CRResetPasswordController.m
//  CRChatRoom
//
//  Created by CuiFengshuai on 15/11/26.
//  Copyright © 2015年 SecondGroup. All rights reserved.
//

#import "CRResetPasswordController.h"
#import "CRResetPasswordView.h"
#import "CRResetOldPWDView.h"
@interface CRResetPasswordController ()


@end

@implementation CRResetPasswordController
#pragma mark >>>> 懒加载

#pragma mark >>>> 系统方法
- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 自定义控件初始化
    [self setupSubViews];
    
    // 初始化数据模型
    [self initData];
}

#pragma mark >>>> 初始化方法

/**
 *  自定义控件初始化
 */
- (void)setupSubViews {
    
    if (_isResetByPhone) {
        CRResetPasswordView *resetPasswordView = [CRResetPasswordView resetPasswordByPhone];
        resetPasswordView.frame = self.view.bounds;
        [resetPasswordView resetPasswordByPhone];
        [self.view addSubview:resetPasswordView];
    } else {
        CRResetOldPWDView *resetOldPWDView = [CRResetOldPWDView resetPasswordByOldPassword];
        resetOldPWDView.frame = self.view.bounds;
        [resetOldPWDView resetPasswordByOldPwd];
        [self.view addSubview:resetOldPWDView];
    }
    
    // 添加手势
    UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapRecognizerAction:)];
    [self.view addGestureRecognizer:tapRecognizer];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(20, 20, 40, 30);
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(didClickBackButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}
/**
 *  初始化数据模型
 */
- (void)initData {
    
}

#pragma mark >>>> 事件监听方法
- (void)didTapRecognizerAction:(UIGestureRecognizer *)recognizer {
    [self.view endEditing:YES];
}

- (void)didClickBackButton:(UIButton *)button {
    [self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark >>>> 实现代理方法


#pragma mark >>>> 其他方法

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
